﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tpcs4_cours
{
    class Program
    {
        /// <summary>
        /// Test the previous functions.
        /// </summary>
        static void Main(string[] args)
        {
            int a;
            int b;
            int[] array;
            uint size;
            int max;
            int seed;

            Console.Title = "Exercice 1";
            Console.ForegroundColor = ConsoleColor.White;

            #region TEST SWAP
            a = 2;
            b = 4;

            Console.WriteLine("Before swap:\t\ta = " + a + ", b = " + b);
            Vector.Swap(a, b);
            Console.WriteLine("Swap without ref:\ta = " + a + ", b = " + b);
            Vector.Swap_ref(ref a, ref b);
            Console.WriteLine("Swap with ref:\t\ta = " + a + ", b = " + b);
            #endregion

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("\n--\nPress ENTER: ARRAY");
            Console.ForegroundColor = ConsoleColor.White;
            Console.ReadKey();
            Console.Clear();

            #region TEST ARRAY
            size = 40;
            max = 100;
            seed = 42;
            array = new int[size];

            Console.WriteLine("The content of the initialized array is:");
            Vector.Init_array(array, -1, size);
            Vector.Print_array(array, size);

            Console.WriteLine("\nThe content of the random initialized array is:");
            Vector.Init_rand_array(array, max, seed, size);
            Vector.Print_array(array, size);

            Console.WriteLine("\nThe content of the sorted array is:");
            Vector.Sort_swap_array(array, size);
            Vector.Print_array(array, size);
            #endregion

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("\n--\nPress ENTER: EXIT");
            Console.ReadKey();
        }

    }
}
